<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/3/1
 * Time: 14:53
 */
/*require("../../vendor/autoload.php");
$swagger = \Swagger\scan('./');
header('Content-Type: application/json');
echo $swagger;*/

$jsonData = array(
    "openapi" => "3.0.0",
    "info" => [
        "title" => "艾高高api文档",
        "version" => "3.0.0",
        "description" => "艾高高api"
    ],
    "servers" => [
        [
            'url' => "http://log.local/ui/swapi/v1/index.php/",
            'description' => '基本地址版本1'
        ],
        [
            'url' => "http://log.local/ui/swapi/v2/index.php/",
            'description' => '基本地址版本2'
        ],
    ],
    "tags" => [
        [
            "name" => "用户模块",
            "description" => "用户模块............",
            "externalDocs" => [
                'url' => "http://www.baidu.com"
            ],

        ],

    ],
    'schemes' => ["https"],
    "paths" => [
        "/users" => [
            "get" => [
                "summary" => "Returns a list of users.",
                "tags" => ["用户模块"],
                "description" => "Optional extended description in CommonMark or HTML",
                "responses" => [
                    '200' => [
                        "description" => "A JSON array of user names",
                    ]
                ],
            ]
        ],
    ],
    'components'=>[
          'schemas'=>[
              'user'=>[
                  'type' => 'object',
                  'properties' => [
                      'id' => [
                          'type' => 'integer',
                      ],
                      'username' => [
                          'type' => 'string',
                      ]
                  ],
              ]

          ]
    ],

);
header('Content-Type: application/json');
echo json_encode($jsonData);